package test.pcs;

import com.payment.lc.pcs.client.wrap.bo.ProductionAttributes;
import com.payment.lc.pcs.client.wrap.bo.ProductionPurchaseAttributes;
import com.payment.lc.pcs.client.wrap.bo.ProductionRedeemAttributes;
import com.payment.lc.pcs.client.wrap.bo.ProductionTimeAttributes;
import com.payment.lc.pcs.client.wrap.service.ProductionWrapService;
import com.payment.lc.pcs.service.api.DateTypeService;
import com.payment.lc.pcs.service.api.DynamicDataService;
import com.payment.lc.pcs.service.api.ProductionService;
import com.payment.lc.pcs.service.api.ProductionServiceV20;
import com.payment.lc.pcs.service.bo.*;
import com.payment.lc.pcs.service.domain.DateTypeInfo;
import com.payment.lc.pcs.service.domain.ListWrapper;
import com.payment.lc.pcs.service.domain.Production;
import com.payment.lc.pcs.service.domain.Provider1;
import com.payment.lc.pcs.util.impl.DateComputeUtilImpl;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import test.BaseTest;

/**
 * Created on 2016/8/8.
 */
public class Demo1PcsTest6SellInfo extends BaseTest {

    @Autowired
    private DynamicDataService dynamicDataService;

    @Autowired
    private ProductionWrapService productionWrapService;

    @Autowired
    private ProductionServiceV20 productionServiceV20;

    @Autowired
    DateTypeService dateTypeService;

    @Autowired
    DateComputeUtilImpl dateComputeUtil;

    @Autowired
    ProductionService productionService;

    @Test
    public void test() {
//        test3();
        test4();
//        test9();
    }

    void test4() {
        String prodCode = "SF2883";
        ProductionSellInfo sellInfo = dynamicDataService.getProductionSellInfo(prodCode);
        display(sellInfo);

        ProductionPurchaseAttributes productionPurchaseAttributes = productionWrapService.getProductionPurchaseAttributes(productionWrapService.getProduction(prodCode), false);
        display(productionPurchaseAttributes);
    }

    void test3() {
        DateTypeInfo dateTyeInfos = dateTypeService.getDateTyeInfos();
        display(dateTyeInfos);
        DateTypeInfo dateTypeInfo = dateComputeUtil.getDateTypeInfo();
        display(dateTypeInfo);
    }

    void test1() {
        String prodCode = "KT10008";
        Production production = productionWrapService.getProduction(prodCode);
        ProductionRedeemAttributes redeemAttributes = productionWrapService.getProductionRedeemAttributes(production, false);
        display(redeemAttributes);

        ListWrapper<MiCategory> miCategories = productionServiceV20.getMiCategories();
        display(miCategories);

        ProductionTimeAttributes timeAttributes = productionWrapService.getProductionTimeAttributes(production, false);
        display(timeAttributes);

        ProductionPurchaseAttributes purchaseAttributes = productionWrapService.getProductionPurchaseAttributes(production, false);
        display(purchaseAttributes);

        print(production);

        ProductionAttributes productionAttributes = productionWrapService.getProductionAttributes(production);
        display(productionAttributes);

        Provider1 provider = productionService.getProvider(prodCode);
        display(provider);


    }

    void test2() {
        String prodCode = "KT10009";
        ProductionSellInfo sellInfo = productionWrapService.getProductionSellInfo(prodCode, false);
        display(sellInfo);
    }

    void test9() {
        String prodCode = "KT10009";

        ProductionSellDataV2 sellDataV2 = dynamicDataService.getProductionSellDataV2(prodCode);
        display(sellDataV2);

        ProductionSellInfo sellInfo = dynamicDataService.getProductionSellInfo(prodCode);
        display(sellInfo);

        ProductionValue productionValue = dynamicDataService.getProductionValue(prodCode);
        display(productionValue);

        ProductionTime productionTime = dynamicDataService.getProductionTime(prodCode);
        display(productionTime);
    }
}
